import React from "react";
import {Text, TextInput, View} from "react-native";
import FormStyle from "../style/form-style";

export default class FormTextWidget extends React.Component {

    _onChangeText(text) {
        if (this.props.onChangeText) {
            this.props.onChangeText(text);
        }
    }

    render() {
        return (
            <View style={[FormStyle.row, this.props.style]}>
                <Text style={FormStyle.rowLeft}>
                    {this.props.name}
                </Text>
                <TextInput style={[FormStyle.rowRight, {backgroundColor: '#f3f3f3',marginLeft:5}]}
                           placeholder={this.props.placeholder}
                           value={this.props.value}
                           keyboardType={this.props.keyboardType}
                           onChangeText={(text) => this._onChangeText(text)}
                />
            </View>
        )
    }
}
